package com.alibaba.datax.plugin.reader.aliyunslsreader;

import com.alibaba.datax.common.plugin.RecordSender;
import com.alibaba.datax.common.plugin.TaskPluginCollector;
import com.alibaba.datax.common.util.Configuration;
import com.aliyun.openservices.loghub.client.interfaces.ILogHubProcessor;
import com.aliyun.openservices.loghub.client.interfaces.ILogHubProcessorFactory;

public class LogHubProcessorFactory implements ILogHubProcessorFactory {
    private RecordSender recordSender;
    public void setRecordSender(RecordSender recordSender) {
        this.recordSender = recordSender;
    }

    private Configuration taskConfig;
    public void setConfiguration(Configuration taskConfig) {
        this.taskConfig = taskConfig;
    }

    private TaskPluginCollector taskPluginCollector;
    public void setTaskPluginCollector(TaskPluginCollector taskPluginCollector) {
        this.taskPluginCollector = taskPluginCollector;
    }

    public ILogHubProcessor generatorProcessor() {
        // 生成一个消费实例。
        LogHubProcessor logHubProcessor = new LogHubProcessor();
        logHubProcessor.setRecordSender(this.recordSender);
        logHubProcessor.setConfiguration(this.taskConfig);
        logHubProcessor.setTaskPluginCollector(this.taskPluginCollector);
        return logHubProcessor;
    }
}
